package designpatterns.proxy.dynamicproxy;


import java.util.HashMap;

/**
 * JDK动态代理：基于接口
 */
public class Client {
    public static void main(String[] args) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("title", "JDK动态代理");
        ITable table = new TableImpl();
        TableProxyFactory proxyFactory = new TableProxyFactory(table);
        ITable proxyInstance = (ITable) proxyFactory.getProxyInstance();
        // 代理对象调用方法
        proxyInstance.add(map);
        proxyInstance.update(map);
    }
}
